﻿@using Chaine.Models
@model IList<RegisterModel>
@{
    ViewBag.Title = "Members";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section maincontent{
    @if (TempData["update-successded"] != null)
    {
        <div class="alert alert-success">
            <a class="close" data-dismiss="alert" href="#">×</a> Update successded.
        </div>
    }
    @if (TempData["delete-success"] != null)
    {
        <div class="alert alert-success">
            <a class="close" data-dismiss="alert" href="#">×</a> Delete successded.
        </div>
    }
    <h2 class="page-header">@ViewBag.Title</h2>
    <table class="table table-striped table-bordered">
        <thead>
            <tr>
                <th>
                    #
                </th>
                <th>
                    UserName
                </th>
                <th>
                    Email
                </th>
                <th>
                    Real Name
                </th>
                <th>
                    Mobile
                </th>
                <th>
                    Status
                </th>
                <th>
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                var index = Model.IndexOf(item);
                <tr>
                    <td>
                        @(index + 1)
                    </td>
                    <td>
                        @item.UserName
                    </td>
                    <td>
                        @item.Email
                    </td>
                    <td>
                        @item.RealName
                    </td>
                    <td>
                        @item.Mobile
                    </td>
                    <td>
                        <span class="label 
                        @{
                var status = item.Status.ToLower();
                if (status.Equals("admin"))
                {
                    @("label-important");
                }
                if (status.Equals("member"))
                {
                    @("label-success");
                }
                if (status.Equals("is not approved"))
                {
                                @("")
                }
                if (status.Equals("email is invalidatived"))
                {
                                @("label-warning")
                }
                }
                       
                        ">
                            @item.Status
                        </span>
                    </td>
                    <td>
                        @Html.ActionLink("Edit", "edit", new { id = item.Id })
                    </td>
                </tr>
   
            }
        </tbody>
    </table>
}
@section sidebar{
    @Html.Partial("~/views/shared/_AdminSidebar.cshtml")
}
